﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 备忘录模式
{
    /// <summary>
    /// 第三方保存容器
    /// </summary>
   public class Caretaker
    {

        //private static War3Memento _War3Memento = null;

        //public static void SabeWar3Memento(War3Memento war3Memento)
        //{
        //    _War3Memento = war3Memento;
        //}

        //public static War3Memento GetWar3Memento()
        //{
        //    return _War3Memento;
        //}

        private static Dictionary<string, War3Memento> _War3MementoDic = new Dictionary<string, War3Memento>();

      

        public static void SaveWar3Memento(string name,War3Memento war3Memento)
        {

            _War3MementoDic.Add(name, war3Memento);
        }

        public static War3Memento GetWar3Memento(string name)
        {
            if (_War3MementoDic.ContainsKey(name))
            {
                return _War3MementoDic[name];
            }
            return null;
        }
    }
}
